



//
//  NHistroyRecordViewController.m
//  nncloud
//
//  Created by macfai on 2018/9/20.
//  Copyright © 2018年 youedata. All rights reserved.
//

#import "NHistroyRecordViewController.h"
#import "NMineCell.h"
#import "NNGAnalysisViewController.h"
@interface NHistroyRecordViewController ()<UITableViewDelegate,UITableViewDataSource>

@property (nonatomic,strong)UITableView *tableView;
@property (nonatomic,strong)NSArray *titles;

@end

#define cellIdentifier @"mineid"
#define SectionHeaderHeight 15.f

@implementation NHistroyRecordViewController

- (UITableView *)tableView{
    if (!_tableView) {
        
    
    _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0 , 0, ScreenWidth , ScreenHeight - 64-49) style:UITableViewStyleGrouped];
    _tableView.delegate = self;
    _tableView.dataSource = self;
    _tableView.rowHeight = 55.f;
    _tableView.backgroundColor = kBackgroundColor;
    [_tableView registerNib:[UINib nibWithNibName:@"NMineCell" bundle:nil] forCellReuseIdentifier:cellIdentifier];
    _tableView.showsVerticalScrollIndicator = NO;
    _tableView.tableFooterView = [UIView new];
    }
    return _tableView;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    [self.navigationItem setItemWithTitle:@"历史统计" textColor:kNavigationTitleColor fontSize:18 itemType:center];
    
    self.titles = @[@"1月营商服务统计",];
    [self.view addSubview:self.tableView];
    
    // Do any additional setup after loading the view from its nib.
}


-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return  self.titles.count;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 1;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    
    NMineCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier forIndexPath:indexPath];
    cell.flag = @"hist";
    [cell configWithPicName:nil title:self.titles[indexPath.section] withIndexPath:indexPath];
    cell.nameLabelLeftMargin.constant = 30.f;
    return cell;
}

#pragma delegate

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    switch (indexPath.section) {
        case 0:
        {
            NNGAnalysisViewController *month = [NNGAnalysisViewController new];
            month.month = 8;
            month.webUrl = kYingShangUrl;
            month.hidesBottomBarWhenPushed = YES;
            [self.navigationController pushViewController:month animated:YES
             ];
            
        }
            break;
            
        case 1:
        {
            NNGAnalysisViewController *month = [NNGAnalysisViewController new];
            month.month = 7;
            month.webUrl = kYingShangUrl;
            month.hidesBottomBarWhenPushed = YES;
            [self.navigationController pushViewController:month animated:YES
             ];
        }
            break;
        case 2:
        {
            NNGAnalysisViewController *month = [NNGAnalysisViewController new];
            month.month = 6;
            month.webUrl = kYingShangUrl;
            month.hidesBottomBarWhenPushed = YES;
            [self.navigationController pushViewController:month animated:YES
             ];
        }
            break;
            
        default:
            break;
    }
}

-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    return SectionHeaderHeight;//如果设置section的header高度，不设置footer高度，footer默认等于header高度
}

- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
    return 0;
}

- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
    return nil;
}




@end
